/////////////////////////////////////////////////////////////////////
//@time:2013-03-23 14:00
//@author:lwd
//
//interface of the queue
////////////////////////////////////////////////////////////////////
#ifndef __QUEUE_H_
#define __QUEUE_H_

#include "Process.h"

#define QElemType Process

typedef enum{
	OK,
	ERROR
}Status;

typedef struct QNode{
	QElemType data;
	struct QNode *next;			//point to the next node in the queue
}QNode, *QueuePtr;

typedef struct Queue{
	QueuePtr front;				//head of queue
	QueuePtr rear;				//end  of queue
}LinkQueue;

/////////////////////////////////////////////////////////////////////
Status initQueue(LinkQueue *Q);
Status DestoryQueue(LinkQueue *Q);
Status EnQueue(LinkQueue *Q, QElemType  e);
Status DeQueue(LinkQueue *Q, QElemType *e);
Status IsEmpty(const LinkQueue Q);
Status TravelQueue(const LinkQueue Q, QElemType *e, int (*cmp)(QElemType *a, QElemType *b));

Status DeleteElem(LinkQueue *Q, QElemType *e, int (*cmp)(QElemType *a, QElemType *b));
#endif
